<?php 
if (count($this->data) == 0):
	echo "Collection is empty.<br/>";
else:
    foreach ($this->data as $document):
?>
Document ID: <?php echo $document->getID() ?><br/>
Document data: <br/>
<?php 
    foreach($document->getFields() as $key => $value) { 
        echo "<b>$key</b>: $value<br/>\n";
    }
?>
<form method="POST" action="<?php echo $this->url(array("action" => "delete-document", "controller" => "document"), "", true) ?>" style="display: inline">
<input type="hidden" name="name" value="<?php echo $this->collection ?>">
<input type="hidden" name="id" value="<?php echo $document->getID() ?>">
<input type="submit" value="Delete" style="display: inline">
</form> <hr>
<?php 
    endforeach;
endif;
?>

<form method="POST" action="<?php echo $this->url(array("action" => "add-document", "controller" => "document"), "", true) ?>" style="display: inline">
<input type="hidden" name="name" value="<?php echo $this->collection ?>">
<input type="submit" value="Add Document" style="display: inline">
</form>
